package cn.itcast.goods.book.web.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.itcast.goods.book.service.BookService;
import cn.itcast.servlet.BaseServlet;

public class BookServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
	BookService bookService=new BookService();
	
	/**
	 * 获取当前页码
	 */
	int getPC(HttpServletRequest request){
		int pc=1;
		String param=request.getParameter("pc");
		if(param!=null&!param.trim().isEmpty()){
			try {
				pc=Integer.parseInt(param);
			} catch (RuntimeException e) {
				// TODO: handle exception
			}
		}
		return pc;
	}
	
	public  String findByCategory(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		/**
		 * 1.得到PC，如果页面传递，则使用传递的值，否则pc=1
		 */
		int pc=getPC(req);
		/**
		 * 2.得到url
		 */
		
	}
}
